package com.fastwire.carriere.mbean;

import com.fastwire.carriere.common.util.CommonLogger;
import com.fastwire.carriere.schedule.MultiTaskScheduler;

public class CarrierEService implements CarrierEServiceMBean {

	public String startScheduler ;
	@Override
	public void startSchedulars() {

		System.out.println("start CarrierE Mbean");
		//CommonLogger.info(this, "Started and  Initialized  CarrierE Mbean: " );
		MultiTaskScheduler scheduler = MultiTaskScheduler.getInstance();
		scheduler.init();

	}

	@Override
	public void start() throws Exception {	
		
		if (getStartScheduler().equalsIgnoreCase("true"))
		{
			System.out.println("Start CarrierEServiceMBean");
			CommonLogger.info(this, "Starting CarrierEServiceMBean" );
			startSchedulars();
		}
		else
			CommonLogger.info(this, "Not Starting CarrierEServiceMBean" );

	}

	@Override
	public void stop() throws Exception {
		System.out.println("Stop CarrierEServiceMBean");
		CommonLogger.info(this, "Stop CarrierEServiceMBean " );
	}
	
	@Override
	public String getStartScheduler()
	{
		 return startScheduler;
	}
	
	@Override
	public void setStartScheduler(String flag)
	{
		startScheduler= flag;
	}

}
